package com.huike.contract.mapper;


import java.util.List;


import com.huike.clues.domain.vo.IndexStatisticsVo;
import com.huike.contract.domain.TbContract;
import com.huike.contract.domain.dto.TbContractDTO;
import com.huike.contract.domain.vo.TbContractVO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;
import org.apache.ibatis.annotations.Select;

/**
 * 合同Mapper接口
 * @date 2021-05-19
 */
@Mapper
public interface TbContractMapper {


    public TbContract selectTbContractById(Long id);

    /**
     * 查询合同列表
     *
     * @param tbContract 合同
     * @return 合同集合
     */
    public List<TbContract> selectTbContractList(TbContract tbContract);

    /**
     * 新增合同
     *
     * @param tbContract 合同
     * @return 结果
     */
    public int insertTbContract(TbContract tbContract);

    /**
     * 修改合同
     *
     * @param tbContract 合同
     * @return 结果
     */
    public int updateTbContract(TbContract tbContract);

    /**
     * 删除合同
     *
     * @param id 合同ID
     * @return 结果
     */
    public int deleteTbContractById(Long id);

    /**
     * 批量删除合同
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteTbContractByIds(Long[] ids);


    // 查询当前时间范围内的用户数
    @Select("select count(*) from tb_contract where status = 4 and create_time between #{beginTime} and #{endTime}")
    Long getontractStatistics(@Param("beginTime") LocalDateTime beginCurrentTime, @Param("endTime") LocalDateTime endCurrentTime);

    List<TbContractVO> contractStatisticsList( TbContractDTO contractDTO);

    /**
     * 查询合同数
     * @param
     * @return
     */
    @Select("select count(*) from tb_contract where" +
            " status =4 and create_time between #{begin} and  #{end}")
    Integer businessNums(@Param("begin") LocalDateTime beginTime, @Param("end") LocalDateTime endTime);
}
